#!/local/tools/repository/php-4.4.4/bin/php
<?php

print_r($argv);
function error($msg)
{
  print get_date("/")." ".get_time(":")." [ERROR] " .$msg;
}


function get_date($separator)
{
  if (!defined($separator))
    {
      $separator="/";
    }
  
  $now_date = date("Y".$separator."m".$separator."d");
  
  return $now_date;
}

function get_time($separator)
{
  if (!defined($separator))
    {
      $separator=":";
    }
  
  $now_time = date("H".$separator."i".$separator."s");
  
  return $now_time;
}

if (!isset($argv[1]))
{
  error("Missing arguments.\n");
  exit;
}

$ajout_code_product=$argv[1];
if (ereg("^3DS[0-9][0-9][0-9][0-9][0-9][A-Z\-][A-Z\-][A-Z\-][A-Z\-]$",$ajout_code_product) || ereg("^3DS[0-9][0-9][0-9][0-9][0-9]$",$ajout_code_product) || (ereg("^T[0-9][0-9][0-9][0-9][0-9][0-9][0-9][A-Z\-][A-Z\-][A-Z\-][A-Z\-]$",$ajout_code_product) || ereg("^T[0-9][0-9][0-9][0-9][0-9][0-9][0-9]$",$ajout_code_product)) || (ereg("^SAA[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]$",$ajout_code_product)) || (ereg("^SAB[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]$",$ajout_code_product)) || (ereg("^[0-9]{13}$",$ajout_code_product)))
{
  print "code is good\n";
}
else
{
  print "code is bad\n"; 
}

?>